package com.gigmissions.client.ui;

import com.gigmissions.client.config.GigMissionsMessages;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class AddGigPanel extends VerticalPanel {
	
	private Button submitButton;
	private TextBox titleText;
	private TextBox streetText;
	private TextBox cityText;
	private TextBox countryText;
	private GigMissionsMessages messages;
	private FlexTable layout;
	
	@Inject
	public AddGigPanel(GigMissionsMessages messages,
						Button submitButton,
						TextBox titleText,
						TextBox streetText,
						TextBox cityText,
						TextBox countryText,
						FlexTable layout
						){
		
		this.submitButton = submitButton;
		this.titleText = titleText;
		this.streetText = streetText;
		this.cityText = cityText;
		this.countryText = countryText;
		this.messages = messages;
		this.layout = layout;
		build();
	}
	
	public void build(){
		

		layout.setCellSpacing(6);
		FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
		  // Add a title to the form
	    layout.setHTML(0, 0, messages.addGigFormTitle());
	    cellFormatter.setColSpan(0, 0, 2);
	    cellFormatter.setHorizontalAlignment(0, 0,
	    HasHorizontalAlignment.ALIGN_LEFT);
	 // Add some standard form options
	    layout.setHTML(1, 0, messages.addGigFormTextTitle());
	    layout.setWidget(1, 1,this.titleText);
	    layout.setHTML(2, 0, messages.addGigFormStreetTitle());
	    layout.setWidget(2, 1,this.streetText);
	    layout.setHTML(3, 0, messages.addGigFormCityTitle());
	    layout.setWidget(3, 1, this.cityText);
	    layout.setHTML(4, 0, messages.addGigFormCountryTitle());
	    layout.setWidget(4, 1, this.countryText);
	    layout.setHTML(5, 0, "&nbsp;");
	    submitButton.setText(messages.submit());
	    layout.setWidget(5,1, this.submitButton);
		this.add(layout);
		
	}

	public Button getSubmitButton() {
		return submitButton;
	}

	public TextBox getTitleText() {
		return titleText;
	}

	public TextBox getStreetText() {
		return streetText;
	}

	public TextBox getCityText() {
		return cityText;
	}

	public TextBox getCountryText() {
		return countryText;
	}
	
	
	
	

}
